package com.example.library_common.db;

import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Embedded;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

import com.alibaba.fastjson.JSON;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Entity(tableName = "shop_car_bean")
public class ShopCarBean implements Serializable {

    public ShopCarBean() {
        this.userId = "";
//        mList =new ArrayList<>();
    }

    @PrimaryKey
    @NonNull
    @ColumnInfo(name = "userId", defaultValue = "")
    private String userId;

    /**
     * {@link com.example.library_common.db.GoodsDetailMsBean}
     */
    @ColumnInfo(name = "shopCarList", defaultValue = "")
    private String shopCarList;

    //    @Embedded
//    private List<GoodsDetailMsBean> mList ;
//
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getShopCarList() {
        return shopCarList;
    }

    public void setShopCarList(String shopCarList) {
        this.shopCarList = shopCarList;
    }

    public List<GoodsDetailMsBean> getShopCarList22() {
        List<GoodsDetailMsBean> ls = new ArrayList<>();
        String shopCarList = getShopCarList();
        if (!TextUtils.isEmpty(shopCarList)) {
            ls = JSON.parseArray(shopCarList, GoodsDetailMsBean.class);
        }
        return ls;
    }


    //
//    public List<GoodsDetailMsBean> getList() {
//        return mList;
//    }
//
//    public void setList(List<GoodsDetailMsBean> mList) {
//        this.mList = mList;
//    }
}
